package com.portal.innovation.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.portal.innovation.common.Constant;
import com.portal.innovation.utils.PageUtils;
import com.portal.innovation.dao.FaqDao;
import com.portal.innovation.pojo.Faq;
import com.portal.innovation.service.FaqService;
import org.springframework.stereotype.Service;

import java.util.HashMap;


@Service("faqService")
public class FaqServiceImpl extends ServiceImpl<FaqDao, Faq> implements FaqService {


    @Override
    public PageUtils queryPage(HashMap params) {
        Integer curPage = 1;
        Integer limit = 10;

        if(params.get(Constant.PAGE) != null){
            curPage = Integer.parseInt(params.get(Constant.PAGE).toString());
        }
        if(params.get(Constant.LIMIT) != null){
            limit = Integer.parseInt(params.get(Constant.LIMIT).toString());
        }
        //分页对象
        Page<Faq> page = new Page<>(curPage, limit);

        PageUtils pageUtils = new PageUtils(this.page(page, null));
        return pageUtils;
    }
}